/**
 * @param {string} s
 * @return {number}
 */
 var sumScores = function(s) {
  let ans = 0
  const mp = new Map()
  let t = ''
  for(let ch of s) {
    t += ch
    mp.set(t.length, t)
  }
  let c = ''
  for(let i = s.length-1; i>=0; i--) {
    c = s[i] + c
    ans += calc(c)
  }
  return ans
  function calc(c) {
    let l = 0, r = c.length
    while(l < r) {
      let m = ((l + r - 1) >> 1) + 1
      let cur = mp.get(m)
    }
    return l
  }
};

